# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=binaryninja
pkgver=5.2.8722
pkgrel=1
pkgdesc='A new kind of reversing platform (demo version).'
groups=('blackarch' 'blackarch-reversing' 'blackarch-binary')
arch=('x86_64')
url='https://binary.ninja/free/'
license=('custom:commercial' 'evaluation')
depends=('libglvnd' 'libxkbcommon-x11')
replaces=("$pkgname-demo")
provides=("$pkgname")
source=('https://cdn.binary.ninja/installers/binaryninja_free_linux.zip'
        'LICENSE')
sha512sums=('c39557507bf471eea8a55a01e2e0b7604f6f30946ecacdaf6efa2d69a21052e19386a1f72a1b787f43c5adc2f883725925585b2349db7ec260471ff17980c60d'
            '34c2406eb4cd7f80291008753ee72d06e746d95a2c0c63a336b72ccecc4e0eba2449f5e19490d1b44836db6356a90f175f953305962c345d223063ded5abf14a')
install="$pkgname.install"

package() {
  cd binaryninja

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 $srcdir/LICENSE \
    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  cp -a * "$pkgdir/usr/share/$pkgname"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec ./binaryninja "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

